/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import java.util.List;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Renato
 */
@Entity
@Table(name = "cliente")
@NamedQueries({@NamedQuery(name = "Cliente.findAll", query = "SELECT c FROM Cliente c"), @NamedQuery(name = "Cliente.findById", query = "SELECT c FROM Cliente c WHERE c.id = :id"), @NamedQuery(name = "Cliente.findByNome", query = "SELECT c FROM Cliente c WHERE c.nome = :nome"), @NamedQuery(name = "Cliente.findByEndRua", query = "SELECT c FROM Cliente c WHERE c.endRua = :endRua"), @NamedQuery(name = "Cliente.findByEndBairro", query = "SELECT c FROM Cliente c WHERE c.endBairro = :endBairro"), @NamedQuery(name = "Cliente.findByEndCidade", query = "SELECT c FROM Cliente c WHERE c.endCidade = :endCidade"), @NamedQuery(name = "Cliente.findByEndCep", query = "SELECT c FROM Cliente c WHERE c.endCep = :endCep"), @NamedQuery(name = "Cliente.findByEndUf", query = "SELECT c FROM Cliente c WHERE c.endUf = :endUf"), @NamedQuery(name = "Cliente.findByEmail", query = "SELECT c FROM Cliente c WHERE c.email = :email"), @NamedQuery(name = "Cliente.findByReceberNews", query = "SELECT c FROM Cliente c WHERE c.receberNews = :receberNews")})
public class Cliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "nome")
    private String nome;
    @Column(name = "end_rua")
    private String endRua;
    @Column(name = "end_bairro")
    private String endBairro;
    @Column(name = "end_cidade")
    private String endCidade;
    @Column(name = "end_cep")
    private String endCep;
    @Column(name = "end_uf")
    private String endUf;
    @Column(name = "email")
    private String email;
    @Column(name = "receber_news")
    private Boolean receberNews;
    @JoinTable(name = "compras_cliente", joinColumns = {@JoinColumn(name = "id_cliente", referencedColumnName = "id")}, inverseJoinColumns = {@JoinColumn(name = "id_cardapio", referencedColumnName = "id")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<Cardapio> cardapioCollection;

    public Cliente() {
    }

    public Cliente(Integer id) {
        this.id = id;
    }

    public Cliente(Integer id, String nome) {
        this.id = id;
        this.nome = nome;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getEndRua() {
        return endRua;
    }

    public void setEndRua(String endRua) {
        this.endRua = endRua;
    }

    public String getEndBairro() {
        return endBairro;
    }

    public void setEndBairro(String endBairro) {
        this.endBairro = endBairro;
    }

    public String getEndCidade() {
        return endCidade;
    }

    public void setEndCidade(String endCidade) {
        this.endCidade = endCidade;
    }

    public String getEndCep() {
        return endCep;
    }

    public void setEndCep(String endCep) {
        this.endCep = endCep;
    }

    public String getEndUf() {
        return endUf;
    }

    public void setEndUf(String endUf) {
        this.endUf = endUf;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Boolean getReceberNews() {
        return receberNews;
    }

    public void setReceberNews(Boolean receberNews) {
        this.receberNews = receberNews;
    }

    public List<Cardapio> getCardapioCollection() {
        return cardapioCollection;
    }

    public void setCardapioCollection(List<Cardapio> cardapioCollection) {
        this.cardapioCollection = cardapioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Cliente)) {
            return false;
        }
        Cliente other = (Cliente) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Cliente[id=" + id + "]";
    }

}
